//-----------------------------------------------------------------------
// <copyright file="MessageHistory.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Microsoft.Live.Messenger
{
    using System;
    using System.Collections.ObjectModel;
    using System.Collections;

    using Microsoft.Live.Core;

    /// <summary>
    /// Represents the message history of a conversation.
    /// </summary>
    public sealed class MessageHistory : Collection
    {
        internal MessageHistory(object obj, User user)
            : base(obj, user)
        {
        }

        /// <summary>
        /// Gets the last time a message was received.
        /// </summary>
        public DateTime LastReceived
        {
            get { return this.Entity.GetProperty<DateTime>("LastReceived"); }
        }

        internal override object FindOrCreate(MessengerEntity entity)
        {
            return this.User.MessagesFactory.FindOrCreate(entity);
        }
    }
}
